package com.web.hilover.service.impl;

import com.web.hilover.entity.Quote;
import com.web.hilover.mapper.QuoteMapper;
import com.web.hilover.service.QuoteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class QuoteServiceImpl implements QuoteService {
    
    @Autowired
    private QuoteMapper quoteMapper;
    
    @Override
    public Quote getRandomQuote() {
        return quoteMapper.findRandom();
    }
    
    @Override
    public List<Quote> getAllQuotes() {
        return quoteMapper.findAll();
    }
    
    @Override
    public Quote getQuoteById(Long id) {
        return quoteMapper.findById(id);
    }
    
    @Override
    public void addQuote(Quote quote) {
        quoteMapper.insert(quote);
    }
    
    @Override
    public void updateQuote(Quote quote) {
        quoteMapper.update(quote);
    }
    
    @Override
    public void deleteQuote(Long id) {
        quoteMapper.deleteById(id);
    }
} 